#include "myMain.h"

int hrcF1(int const(&p)[SIZE][SIZE])
{
    int hn = 0;
    // the final status ,can external definitions
    int Final[SIZE][SIZE] = {
        {1, 2, 3},
        {8, 0, 4},
        {7, 6, 5}
    };

    int i, j;
    for (i = 0; i < SIZE * SIZE; i++)
    {
        for (j = 0; j < SIZE * SIZE; j++)
        {
            if (Final[i / SIZE][i % SIZE] == p[j / SIZE][j % SIZE]) {
                break;
            }
        }
        //  euclidean distance as a heuristic function
        hn += sqrt(pow((i % SIZE - j % SIZE), 2) + pow((i / SIZE - j / SIZE), 2));
    }
    return hn;
}
